﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace ControlLibary
{
    public static class Resources
    {
        public static Image GetImage(String path)
        {
            var assembly = Assembly.GetExecutingAssembly();

            var full_path = $"{assembly.FullName.Split(',')[0]}.Image.{path}";

            using (Stream rs = assembly.GetManifestResourceStream(full_path))
            {
                if (rs != null)
                {
                    try
                    {
                        Image img = Image.FromStream(rs);

                        return img;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }
            return null;
        }
    }
}
